﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Web.Class;
using Entity;
using BLL.Access;
using BLL;
using System.Data;


namespace Web.Controls.LAIHAN
{
    public partial class UCLHFenHuTopInfo : System.Web.UI.UserControl,IUCLHOperate
    {
        YS_YG_YONGHUXXBLL BllYongHuXX = new YS_YG_YONGHUXXBLL();
        /// <summary>
        /// 流程
        /// </summary>
        YS_LH_LAIHANLCJLBLL lcbll = new YS_LH_LAIHANLCJLBLL();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void InitControl()
        {
            throw new NotImplementedException();
        }

        public ValidateRS Validate()
        {
            throw new NotImplementedException();
        }

        public void ClearInfo()
        {
            txtYongHuM.Text = "";
            txtTongYiSPBH.Text = "";
            txtXuKeSLBH.Text = "";
            txtYeWuY.Text = "";
            txtShouLiRQ.Text = "";
        }

        public void LoadInfo(Entity.YS_LH_LAIHANXX laihanxx)
        {
            string where = " S_YONGHUH='{0}' and i_jlzt=0 and i_leixing=0 ";
            where = string.Format(where,laihanxx.S_YONGHUBH);
            DataTable dt = BllYongHuXX.SelectYS_YG_YONGHUXXesDynamic(where, "", null);
            if (dt != null && dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];
                txtYongHuM.Text = dr["S_YONGHUM"].ToString();
            }
            txtTongYiSPBH.Text = laihanxx.S_TONGYIBM;
            txtXuKeSLBH.Text = laihanxx.S_XUKEBH;
             DataTable user = BusinessTool.GetTextAndValue("view_as_userinfo", "UserID", "UserName", null, string.Format("UserID={0} ", dt.Rows[0]["S_YEWUY"])).Tables[0];

             txtYeWuY.Text = user.Rows[0]["Value"].ToString();

             DataTable lcxx = lcbll.SelectYS_LH_LAIHANLCJLsDynamic(string.Format(" S_LAIHANBH='{0}' and I_LIUCHENGBH={1} ", laihanxx.S_LAIHANBH, 20), "", null);
             if (lcxx != null && lcxx.Rows.Count > 0)
             {
                 txtShouLiRQ.Text = Convert.ToDateTime(lcxx.Rows[0]["D_StartDate"]).ToString("yyyy-MM-dd");

             }
        }
    }
}